21. Appendix D SEGGER SystemView integration instructions

SEGGER SystemView is a real-time recording and visualization tool that reveals the true runtime behavior of an application. To enable SystemView, follow the instructions below.

Configuring SmartSnippets™ Studio projects to support SystemView:

To enable SystemView for a specific build configuration of any SmartSnippets™ Studio project, configure the project to build SystemView’s source files and include header file directories:

  1. Select a project which has the OS_FREERTOS definition enabled. Bare metal projects are currently not supported.
  2. Right click project’s “sdk” subfolder and go to New -> Folder
../_images/image15_01.png

Figure 93 Create a new folder

  1. In the pop-up window select: Advanced -> "Link to alternate location" -> Browse… and select the <sdk_root_directory>/sdk/middleware/segger_tools folder as shown in Figure 94.
../_images/image15_02.png

Figure 94 Select the Linker Folder

  1. Right click project’s name and go to Properties -> C/C++ Build -> Settings -> Tool Settings -> Cross ARM C Compiler -> Includes -> Include Paths (see Figure 95), add the following Workspace folders and click apply:

${workspace_loc:/${ProjName}/sdk/segger_tools/Config}

${workspace_loc:/${ProjName}/sdk/segger_tools/OS}

${workspace_loc:/${ProjName}/sdk/segger_tools/SEGGER}

../_images/image15_03.png

Figure 95 Include folder paths

  1. Open the project’s config/custom_config_*.h file and add Code 44 to add and enable the System View configuration:
Code 44 Enable System View configuration
#define dg_configSYSTEMVIEW (1)

Note

that configTOTAL_HEAP_SIZE should be increased by``dg_configSYSTEMVIEW_STACK_OVERHEAD`` bytes for each system task. For example, if there are 8 system tasks, configTOTAL_HEAP_SIZE should be increased by: (8 * dg_configSYSTEMVIEW_STACK_OVERHEAD) bytes.

  1. To call SEGGER_SYSVIEW_Conf() from application add Code 45. A good place to do this is inside system_init() after the configuration of system clocks:
Code 45 Call System View
#if dg_configSYSTEMVIEW
SEGGER_SYSVIEW_Conf();
#endif
  1. Build and download the application image to DA1468x. Then run the application either by pressing the Reset Button (Release Build) or by start debugging the application.
  2. To disable SystemView, set dg_configSYSTEMVIEW to 0 and rebuild the application.

Running SystemView on the Host:

  1. Start the Segger System View application from SmartSnippets™.
../_images/image15_04.png

Figure 96 System Viewer application

  1. Configure the SEGGER System View as shown in Figure 97.
../_images/image15_05.png

Figure 97 Configuring the SEGGER System Viewer

Note

that the address for the RTT Control Block Detection is located in application’s .map file. For example, for PXP reporter the .map file is located at pxp_reporter/DA14681-01-Release_QSPI. Press Ctrl+F and search the address of the _SEGGER_RTT variable.

  1. On the main SystemView window, press the upper right “Start Recording Button” button.
../_images/image15_06.PNG

Figure 98 Start Recording

  1. One can Stop and Restart the recording at any time using the buttons from SystemView PC Application.

Additional information:

  1. The processing overhead of SystemView is not negligible and can potentially affect system dynamics or cause assertions due to the delays inserted from ISR monitoring. To minimize the impact on time critical ISRs there are some configuration options that allow the user to enable/disable the monitoring of certain aspects of the system, as shown below:
Code 46 Enable/disable the monitoring
/**
 * Enable/Disable SystemView monitoring for BLE related ISRs (BLE_GEN_Handler / BLE_WAKEUP_LP_Handler).
 */
#ifndef dg_configSYSTEMVIEW_MONITOR_BLE_ISR
#define dg_configSYSTEMVIEW_MONITOR_BLE_ISR     (1)
#endif

/**
 *Enable/Disable SystemView monitoring for CPM related ISRs (SWTIM1_Handler / WKUP_GPIO_Handler).
 */
#ifndef dg_configSYSTEMVIEW_MONITOR_CPM_ISR
#define dg_configSYSTEMVIEW_MONITOR_CPM_ISR     (1)
#endif

/**
 *Enable/Disable SystemView monitoring for USB related ISRs (USB_Handler / VBUS_Handler).
 */
#ifndef dg_configSYSTEMVIEW_MONITOR_USB_ISR
#define dg_configSYSTEMVIEW_MONITOR_USB_ISR     (1)
#endif
  1. In applications with heavy IRQ usage it is possible that the currently used 2kb RTT buffer cannot hold all the monitored events and this may cause RTT overflows which simple means that some events are lost. The number of lost events is visible in the System View GUI RTT overflows property.

    To avoid this SEGGER suggest:

    • Minimize the interactions of the debugger with J-Link while the target is running. (i.e. disable live watches)
    • Select a higher interface speed in all instances connected to J-Link. (i.e. The debugger and System Viewer)
    • Choose a larger buffer for System View. (1 - 4 kByte)
    • Run System Viewer stand-alone without a debugger.
  2. System View uses sdk’s RTC, which is clocked by one of the LP clocks. For example, if the LP clock is XTAL32K each timer tic corresponds to ~31us. Events that last less than 30us will be visualized as events that last 31us.

  3. Application/Device name can be set in SEGGER_SYSVIEW_Config_FreeRTOS.c SYSVIEW_APP_NAME/SYSVIEW_DEVICE_NAME definitions. At the same file function _cbSendSystemDesc() is located which sends comma separated IRQ names to the Host PC. Because the internal used buffer is only 128 bytes, not all IRQs are named there. One could use multiple SEGGER_SYSVIEW_SendSysDesc() calls to name all IRQs but this means more processing requirements. It is recommended to leave just one packet there.

  4. Memory overhead is 2Kb RAM for RTT buffers, 256 bytes heap for every thread, 256 bytes stack for the shared IRQ stack and ~5Kb rom.

  5. It is possible to redirect printf messages on SystemView’s host window:

    • if CONFIG_RETARGET is defined, messages go to UART
    • if CONFIG_RTT is defined, messages go to RTT
    • if CONFIG_NO_PRINT is defined, messages are discarded
    • If nothing of the above is defined, but the dg_configSYSTEMVIEW is enabled, messages go to System View’s GUI terminal.

Currently System View supports only integer variables, so %s strings are not printed properly. printf using SystemView inserts delays (because of the temporary disabled IRQs) that may trigger assertions so it is not recommended to be used.